********************************************************************************
*																				*
*					IZA Covid Regression Replication							*
*																				*
********************************************************************************
	
* 	Note: 	
*						The dofile does not require setting up a current directory
*						This is part of the master dofile 
		
*	Prepared using: 	Stata/SE 17.0 for Windows (64-bit) (Revision 6 Apr 2022)


* 	Description:
*						The provided code reproduces all numbers provided in 
*						text in the blog.
		
*						The code is ordered in the same manner as numbers appear 
*						in text. To make it easy to read, each code block is 
* 						numbered and header	is provided to match with that within 
*						the blog text.

	
	
********************************************************************************		

* 								STATS AND REGRESSIONS 	

********************************************************************************
	
	
	* (1) 	Number of jobs in the sample 

	
	use "./Data/firm_survey_relisting.dta", clear

	keep if monthly_date_relist >= td(1dec2019) & monthly_date_relist <= td(01aug2022)
	
	distinct job_id
	
	
	* (2) 	Number of job matches in the sample
	
	use "./Data/match_level_public.dta", clear
	
	keep if date_batch >= td(1dec2019) & date_batch <= td(31aug2022)

	count
	
	* (3) 	Number of job seekers in the sample
	
	distinct memid
	
	
	
******************
	
	* (4) 	Regression for demand of employees
	
	use "./Data/firm_survey_relisting.dta", clear
	
	keep if monthly_date_relist >= td(1dec2019) & monthly_date_relist <= td(01aug2022)
	
	preserve
	
			collapse 	(max) posted_ad industry_classification_fs employee_size_fs covid_period, by(firm_id monthly_date_relist)

			reghdfe posted_ad covid_period, absorb(employee_size_fs industry_classification_fs) vce(cluster firm_id) 
			display (- _b[_cons] + (_b[_cons] + _b[covid_period]))/_b[_cons]

	
	restore
	
******************

	
	* (5) 	Out of the firms that listed vacancies on our platform after the COVID-19 outbreak
	
	preserve
	
			keep firm_id measures_protect_*
			
			drop if measures_protect_1 == .
			sort firm_id

			gen measures_protect_oth = (measures_protect_other!="")
			drop measures_protect_other
			
			label drop _all
	
			ds firm_id, not
			collapse (max) `r(varlist)' , by(firm_id)
	
			reshape long measures_protect_, i(firm_id) j(measure)
			
			replace measures_protect_ = measures_protect_ * 100 if !missing(measures_protect_)

			label define measure 1 "Flexibility to work from home" 2	"Providing masks" 3	"Providing sanitisers" 4	"Limited staff at workplace" 5	"Mandatory social distancing at workplace" 6	"Staff encouraged to stay home if not well" 7	"Other" 8 	"Regularly disinfect high contact surfaces" 9 	"Staff training/posters encouraging good hygiene" 5555	"No measures" 7777	"Don't want to say" 8888	"Don't know" 9999	"Left the survey" 1111	"The respondent does not understand", replace
	
			label values measure measure
			
			drop if inlist(measure, 1111, 7777, 8888, 9999)
			
			distinct firm_id
			local nb_obs = `r(ndistinct)'
						
			tabstat measures_protect_, by(measure) nototal labelwidth(32)
			
	restore
	

********************************************************************************		
********************************************************************************		
********************************************************************************


	use "./Data/firm_survey_relisting.dta", clear

	rename monthly_date_relist monthly_date
			
	keep firm_id cycle job_id monthly_date job_interact* person_interact*
		
	tempfile exposure
	save `exposure'
	

	use "./Data/match_level_public.dta", clear

	destring job_id, replace
	joinby job_id monthly_date using `exposure', unmatched(both)
	drop if _merge == 2
	drop _merge

	generate timeline = 1 if date_batch >= td(1dec2019) & date_batch <= td(31aug2022)
	label variable timeline "Analysis timeline"
	 
	generate covid_period = date_batch >= td(01feb2020) & date_batch <= td(31aug2022) 	
	label variable covid_period "Marking Start of Covid-19"

	generate exposure = 1 if job_interact <=3 & person_interact <= 4
	replace exposure = 0 if job_interact <=3 & (person_interact > 4 & !missing(person_interact))
	replace exposure = 1 if (job_interact > 3 & !missing(job_interact)) & (person_interact <= 3)	
	replace exposure = 0 if (job_interact > 3 & !missing(job_interact)) & (person_interact > 3 & !missing(person_interact))
	
	label define exposure 1 "High Exposure" 0 "Low Exposure", replace
	label values exposure exposure 
	
	label variable exposure "Exposure by interaction of people"
	
	generate exposure_job = 0 if inlist(job_code, 101, 102, 104, 105, 107, 110, 112, 113, 114, 117, 204)
	replace exposure_job = 1 if missing(exposure_job) & !missing(job_code)
	
	label define exposure_job 0 "Low Exposure" 1 "High Exposure", replace
	label values exposure_job exposure_job
	
	label variable exposure_job "Exposure by Job Category type"
	
	generate time_period = 0 if (date_batch >= td(09sep2020) & date_batch <= td(14jan2021))
	replace time_period = 1 if date_batch > td(14jan2021) & date_batch <= td(31aug2022)
	label variable time_period "Timeline within Covid-19 period"
	

******************

	* (6) 	Job search by job seekers on the platform has also decreased 
	*		significantly with COVID-19
	
	reghdfe planinterview_100 covid_period if timeline == 1, vce(cluster memid) noabsorb
	display (- _b[_cons] + (_b[_cons] + _b[covid_period]))/_b[_cons]

	reghdfe planinterview_100 covid_period if female_js == 1 & timeline == 1, vce(cluster memid) noabsorb
	display (- _b[_cons] + (_b[_cons] + _b[covid_period]))/_b[_cons]

	reghdfe planinterview_100 covid_period if female_js == 0 & timeline == 1, vce(cluster memid) noabsorb
	display (- _b[_cons] + (_b[_cons] + _b[covid_period]))/_b[_cons]
	
*******************
	
	* (7) 	Job search by job seekers on the platform has also decreased 
	*		significantly with as COVID-19 progressed
	
	reghdfe planinterview_100 time_period if timeline == 1, vce(cluster memid) noabsorb
	display (- _b[_cons] + (_b[_cons] + _b[time_period]))/_b[_cons]

	reghdfe planinterview_100 time_period if female_js == 1  & timeline == 1, vce(cluster memid) noabsorb
	display (- _b[_cons] + (_b[_cons] + _b[time_period]))/_b[_cons]

	reghdfe planinterview_100 time_period if female_js == 0 & timeline == 1, vce(cluster memid) noabsorb
	display (- _b[_cons] + (_b[_cons] + _b[time_period]))/_b[_cons]

	
*******************
	
	* (8) 	Low exposure jobs experienced a larger decrease in application rates 
	*		during COVID-19 months compared to high exposure jobs.
	
	reghdfe planinterview_100 covid_period if (exposure_job == 1) & timeline == 1, vce(cluster memid) noabsorb
	display (- _b[_cons] + (_b[_cons] + _b[covid_period]))/_b[_cons]

	reghdfe planinterview_100 covid_period if (exposure_job == 0) & timeline == 1, vce(cluster memid) noabsorb
	display (- _b[_cons] + (_b[_cons] + _b[covid_period]))/_b[_cons]


*******************
	
	* (9) 	Low exposure jobs continued to experience larger drop in applicates as
	*		COVID-19 progressed
		
	
	reghdfe planinterview_100 time_period if (exposure == 1) & timeline == 1, vce(cluster memid) noabsorb
	display (- _b[_cons] + (_b[_cons] + _b[time_period]))/_b[_cons]

	reghdfe planinterview_100 time_period if (exposure == 0) & timeline == 1, vce(cluster memid) noabsorb
	display (- _b[_cons] + (_b[_cons] + _b[time_period]))/_b[_cons]
	


********************************************************************************
********************************************************************************	
********************************************************************************	


	use "./Data/match_level_public.dta", clear

	bysort memid date_batch: generate tag_id_date = 1 if _n == 1
	label variable tag_id_date "Unique ID by date"
	
	generate timeline = 1 if date_batch >= td(1dec2019) & date_batch <= td(31aug2022)

	label variable timeline "Analysis timeline"

	generate time_period = 0 if (date_batch >= td(09sep2020) & date_batch <= td(14jan2021))
	replace time_period = 1 if date_batch > td(14jan2021) & date_batch <= td(31aug2022)
	
	label variable time_period "Timeline within Covid-19 period"

	
		
*******************
	
	* (10) 	More jobseekers are working as COVID-19 progressed
	
	reghdfe sear_work time_period if timeline == 1 & tag_id_date == 1, vce(cluster memid) noabsorb
	display (- _b[_cons] + (_b[_cons] + _b[time_period]))/_b[_cons]
	
	reghdfe sear_work time_period if female_js == 0 & timeline == 1 & tag_id_date == 1, vce(cluster memid) noabsorb
	display (- _b[_cons] + (_b[_cons] + _b[time_period]))/_b[_cons]
	
	reghdfe sear_work time_period if female_js == 1 & timeline == 1 & tag_id_date == 1, vce(cluster memid) noabsorb
	display (- _b[_cons] + (_b[_cons] + _b[time_period]))/_b[_cons]
	
	reghdfe sear_work female_js if time_period!=. & tag_id_date == 1, vce(cluster memid) noabsorb
	display (- _b[_cons] + (_b[_cons] + _b[female_js]))/_b[_cons]
	
	
	
********************************************************************************
********************************************************************************	
********************************************************************************	

	
	
